<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script type="text/javascript" src="scripts/boot.js"></script>
</head>
<body>
	<div style="padding:10px;">
		<form id="form1" method="post">
			发送生日短信：<input type="checkbox" class="mini-checkbox" name="keyValue" id="id-keyValue" checked="checked" />
		</form>
		<div style="text-align:center;margin-top: 20px"> 
            <a class="mini-button" onclick="onOk" style="width:60px;">保存</a>       
            <a class="mini-button" onclick="onCancel" style="width:60px;">取消</a>    
        </div>
	</div>

<script type="text/javascript">
mini.parse();
var form = new mini.Form("form1");
$(document).ready(function(){
	$.post("sms_is_send.do",function(data){
		var t = mini.get("id-keyValue");
		if(data.success){
            t.setValue(t.checked);
		}else{
			t.setValue(!t.checked);
		}
	},"json");
});
function SaveData() {
    var o = form.getData(); 
    form.validate();
    if (form.isValid() == false) return;
    $.ajax({
        url: "sms_save_switch.do",
		type: 'post',
		dataType: 'json',
        data: o,
        cache: false,
        success: function (text) {
            if(text.success){
            	window.CloseOwnerWindow("succ");
            }else{
            	mini.alert("数据错误！");
            }
        }
    });
}
function CloseWindow(action) {            
    if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
    else window.close();            
}

function onOk(e) {
    SaveData();
}

function onCancel(e) {
    CloseWindow("cancel");
}

</script>
</body>
</html>